$(function () {
	
	
});
 function del(menuTypeId) {
	 	if(confirm("您确定要删除吗？")){
		 $.post("/delType",{menuTypeId:menuTypeId},function(data){
	 		if(data.success){
	 			alert("删除成功!")
	 			location.replace(data.url);
	 		}else{
	 			alert("删除失败!")
	 		}
	 	},"json");
	 	}
	}
 function upda(menuTypeId) {
	 $.post("/modification",{"menuTypeId":menuTypeId},function(data){
		 if(data.success){
			var  $typeList= $("#typeList").html(" ");
			var pamrs=" <div style='margin:20px;'><label>类型名字:&nbsp;</label>" +
					"<input type='text'name='cate' value="+data.success.cate+">" +
					"<input hidden='hidden' type='text'name='menuTypeId' value="+data.success.menuTypeId+">" +
							"<input type='button' onclick='tijiao()' value='提交'>" +
							"<input type='button' onclick='fanui()' value='返回'>" +
							"</div>";
			$typeList.append(pamrs);
		 }
	 },"json");
 }
 
 function fanui(){
	window.location.href="http://localhost:8080/privider";
 }
 
 
 function tijiao(){
	 var $ti=$("#typeList").serialize();
	 $.post("/upda",$ti,function(data){
		 if(data.success){
			 	alert("修改成功！");
				location.replace(data.url);
			}else{
				alert("修改失败!")
			}
	 },"json");
 }
 
 function addType(){
	 var $addType=$("#addType").serialize();
	 $.post("/addType",$addType,function(data){
		 if(data.success){
			 alert("添加成功！");
			 location.replace(data.url);
		 }else{
			 alert("添加失败！");
		 }
	 },"json");
 }
